//RandomShapes.cpp
//Main program file

#include <iostream>
#include "Shape.h"
#include "Circle.h"
#include "Rectangle.h"
#include "Square.h"
#include "Triangle.h"
#include "Cylinder.h"
#include "Cone.h"
#include "RectPrism.h"
#include "Cube.h"
#include "TriPrism.h"
#include "Random.h"

using namespace std;

void main()
{		Random shapeRandom;
	int shapeNum;
	int shapeType;
	int i = 1;
	float t_A = 0;
	float t_B = 0;
	float t_C = 0;

GenShapeCount:
	shapeNum = shapeRandom.shapeCnt();

	if (shapeNum == 0)
		goto GenShapeCount;

	//cout << shapeNum << endl;

	while (i <= shapeNum)
	{

		shapeType = shapeRandom.shapeType();

		if (shapeType == 1)
		{
			Circle myCircle(shapeRandom.shapePos(), shapeRandom.shapePos(), shapeRandom.shapeSize());
			cout << myCircle << endl;
		}
		else if (shapeType == 2)
		{
			Rectangle myRectangle(shapeRandom.shapePos(), shapeRandom.shapePos(), shapeRandom.shapeSize(), shapeRandom.shapeSize());
			cout << myRectangle << endl;
		}
		else if (shapeType == 3)
		{
			Square mySquare(shapeRandom.shapePos(), shapeRandom.shapePos(), shapeRandom.shapeSize());
			cout << mySquare << endl;
		}
		else if (shapeType == 4)
		{
InvTriangle1:

			t_A = shapeRandom.shapeSize();
			t_B = shapeRandom.shapeSize();
			t_C = shapeRandom.shapeSize();

			Triangle testTriValid;

			while (testTriValid.validateTriangle(t_A, t_B, t_C) != true)
			{
				goto InvTriangle1;
			}

			Triangle myTriangle(shapeRandom.shapePos(), shapeRandom.shapePos(), t_A, t_B, t_C);
			cout << myTriangle << endl;
		}
		else if (shapeType == 5)
		{
			Cylinder myCylinder(shapeRandom.shapePos(), shapeRandom.shapePos(), shapeRandom.shapeSize(), shapeRandom.shapeSize());
			cout << myCylinder << endl;
		}
		else if (shapeType == 6)
		{
			Cone myCone(shapeRandom.shapePos(), shapeRandom.shapePos(), shapeRandom.shapeSize(), shapeRandom.shapeSize());
			cout << myCone << endl;
		}
		else if (shapeType == 7)
		{
			RectPrism myRectPrism(shapeRandom.shapePos(), shapeRandom.shapePos(), shapeRandom.shapeSize(), shapeRandom.shapeSize(), shapeRandom.shapeSize());
			cout << myRectPrism << endl;
		}
		else if (shapeType == 8)
		{
			Cube myCube(shapeRandom.shapePos(), shapeRandom.shapePos(), shapeRandom.shapeSize(), shapeRandom.shapeSize());
			cout << myCube << endl;
		}
		else if (shapeType == 9)
		{
InvTriangle2:

			t_A = shapeRandom.shapeSize();
			t_B = shapeRandom.shapeSize();
			t_C = shapeRandom.shapeSize();

			Triangle testTriValid;

			while (testTriValid.validateTriangle(t_A, t_B, t_C) != true)
			{
				goto InvTriangle2;
			}

			TriPrism myTriPrism(shapeRandom.shapePos(), shapeRandom.shapePos(), t_A, t_B, t_C, shapeRandom.shapeSize());
			cout << myTriPrism << endl;
		}

		i++;
	}


	system("Pause");
}